<?php

if (!defined('BASEPATH'))
	exit('No direct script access allowed');

/*
 * To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
 * Description of category_model
 *
 * @author Subha Sundar Das (subhasundar.das@gmail.com)
 */
class Admin_recent_listing_model extends CI_Model {

	//put your code here


	function __construct() {
		parent::__construct();
		log_message('debug', 'Init Model Initialized');
	}

	
	function get_recent_listing()
	{
	$sql = "Select * from post where status=51 order by id DESC limit 5";
	$query = $this->db->query($sql);
	$result = $query->result();
	return $result; 	
	}
	/*
	function change_status($status=NUll, $id=NULL)
	{
	
		$sql="update review_master set status=$status where id=$id";
		$this->db->query($sql);
	}
	*/
	function change_status($id, $status) {
		if ($status == 1) {
			$sql = "update review_master set status=51 where id=$id";
		}
		if ($status == 51) {
			$sql = "update review_master set status=1 where id=$id";
		}
		$this->db->query($sql);
	}
	
	
	function delete($id=NULL)
	{
		$sql="delete from review_master where id=$id";
		$this->db->query($sql);
	}
}